/*
 * @Author: Starfish_DL
 * @Date: 2020-10-16 13:43:23
 * @LastEditors: Starfish_DL
<<<<<<< HEAD
 * @LastEditTime: 2020-10-16 17:25:11
=======
<<<<<<< HEAD
 * @LastEditTime: 2020-10-16 15:44:38
=======
 * @LastEditTime: 2020-10-16 13:56:52
>>>>>>> 133f9bfd16e645f0d4274af3cfe8959171f905db
>>>>>>> 2f985e8618194e972f27bc57a9d9b2255c0bf719
 * @CurrentVersion: 1.0
 * @Description: 
 */

<<<<<<< HEAD
//note 还可以编写更多的GoldBach来实现该功能，体现了接口的作用；

=======
<<<<<<< HEAD
//note 还可以编写更多的GoldBach来实现该功能，体现了接口的作用；

=======
>>>>>>> 133f9bfd16e645f0d4274af3cfe8959171f905db
>>>>>>> 2f985e8618194e972f27bc57a9d9b2255c0bf719
public class GoldBach implements Split {
    private int n=8;

    public GoldBach(int i) {
        if (i<=6 || i%2!=0) {
            if (i<=6) {
                System.out.println("输入的值太小,不符合要求！");
            } else
            if (i%2!=0) {
                System.out.println("请输入一个偶数！");
            }
            this.n=8;
        }
        System.out.println("赋值成功！");
        this.n=i;
    }

    public boolean isPrime(int n) {
		for(int i=2;i<n;i++) {
			if(n%i==0) {
				return false;
			}
		}
		return true;
    }

    public void splitEven() {
        for(int i=2;i<this.n/2;i++) {
            if(this.isPrime(i)) {
                if (this.isPrime(this.n-i)) {
                    System.out.println(i+" "+(this.n-i));
                }
            }
        }
    }
    public static void main(String[] args) {
        GoldBach g1=new GoldBach(100);
        g1.splitEven();
    }
<<<<<<< HEAD
}
=======
<<<<<<< HEAD
}
=======
}
>>>>>>> 133f9bfd16e645f0d4274af3cfe8959171f905db
>>>>>>> 2f985e8618194e972f27bc57a9d9b2255c0bf719
